package runtimeDemo

import (
	"fmt"
	"runtime"
)

func StartDemo() {
	//m1()
	m2()
}

func m2() {
	for skip := 0; ; skip++ {
		pc, file, line, ok := runtime.Caller(skip)
		if !ok {
			break
		}
		f := runtime.FuncForPC(pc)
		fmt.Printf("skip = %v,pc = %v,file = %v,line = %v,entry = %v,name = %v\n", skip, pc, file, line, f.Entry(), f.Name())
	}
}

func m1() {
	for skip := 0; ; skip++ {
		pc, file, line, ok := runtime.Caller(skip)
		if !ok {
			break
		}
		fmt.Printf("skip = %v,pc = %v,file = %v,line = %v\n", skip, pc, file, line)
	}
}
